<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="Dao.BookDao" %>
<%@ page import="Vao.Book" %>
<%@ page import="Dao.UserDao" %>
<%@ page import="Vao.User" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: Muerzhi
  Date: 2023/12/26
  Time: 15:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册账号</title>
</head>
<body>
<%
    String account=request.getParameter("newAccount");
    String password1=request.getParameter("password1");
    UserDao userDao = new UserDao();
    int i = 0;
    try {
        i = userDao.insertUser(account,password1);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    if (i!=0){
        out.println("<script>");
        out.println("alert('账号"+account+"注册成功,快去登录吧！');");
        out.println("location.href='login.jsp'");
        out.println("</script>");
    }else{
        out.println("<script>");
        out.println("alert('注册失败');");
        out.println("location.href='login.jsp'");
        out.println("</script>");
    }
%>
</body>
</html>
